import request from '@/axios';
import {baseUrl} from "@/config/env";

export const getList = (current, size, params) => {
  return request({
    url: baseUrl+'/ucs-system/menu/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const remove = (ids) => {
  return request({
    url: baseUrl+'/ucs-system/menu/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: baseUrl+'/ucs-system/menu/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: baseUrl+'/ucs-system/menu/submit',
    method: 'post',
    data: row
  })
}

export const getMenuDetail = (id) => {
  return request({
    url: baseUrl+'/ucs-system/menu/detail',
    method: 'get',
    params: {
      id,
    }
  })
}

export const getLazyMenuList = (parentId, params) => {
  return request({
    url: baseUrl+'/ucs-system/menu/lazy-menu-list',
    method: 'get',
    params: {
      ...params,
      parentId
    }
  })
}

export const getMenu = () => request({
    url: baseUrl+'/ucs-system/menu/routes',
    method: 'get',
    params: {
        consoleType: sessionStorage.getItem("SET_CURRENT_CONSOLE")
    }
});
